<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <script src="../lib/vue.js"></script>
    <link
      rel="stylesheet"
      href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
      integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
      crossorigin="anonymous"
    />
  </head>

  <body>
    <div id="app">
      <div class="alert alert-primary" role="alert">
        1、v-bind 绑定一个VALUE值 2、v-on指令给当前元素绑定input事件
      </div>
      <div class="alert alert-secondary" role="alert">
        <input type="text" v-model="message" />
      </div>
      <!-- 手工写入v-model-->
      <div class="alert alert-success" role="alert">
        <input type="text" :value="message" @input="inputchange" />
      </div>
      <!-- 手工写入v-model-->
      <div class="alert alert-success" role="alert">
        <input
          type="text"
          :value="message"
          @input="message =$event.target.value"
        />
      </div>
      <div class="alert alert-danger" role="alert">
        {{message}}
      </div>
    </div>

    <script>
      var vm = new Vue({
        el: '#app',
        data: {
          message: '你好'
        },
        methods: {
          inputchange(event) {
            this.message = event.target.value
          }
        }
      })
    </script>
  </body>
</html>
